package com.vitogiovanni.tobook.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.vitogiovanni.tobook.entity.Locale;
import com.vitogiovanni.tobook.entity.LocaleEndpoint;

/**
 * Servlet implementation class InvitaLavoroServlet
 */
public class UpdateEntitiesServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public UpdateEntitiesServlet() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {

	}

	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
	
		LocaleEndpoint localeEndpoint = new LocaleEndpoint();
		//List<Locale> locali = (List<Locale>) localeEndpoint.listLocale(null, null);
		Locale loc = localeEndpoint.findByName("Locale Taranto");
		
		
		//for(Locale loc: locali){
			loc.getFoto().clear();
			localeEndpoint.updateLocale(loc);
		//}
		resp.sendRedirect("/inserimento.html");
	
	}
}